<?php

declare(strict_types=1);

namespace app\common\model;

class Exam extends Base
{

    protected $name = 'exam';
    public function getCateTextAttr($value, $data)
    {
        return Cate::where('id', $data['cate'])->value('title') ?? "";
    }
    public function getTypesTextAttr($value, $data)
    {
        return self::getTypesList($data['types'], 1);
    }
    public static function getTypesList($value, $type = 1)
    {
        $list = [1 => '单选', 2 => '多选'];
        return $type == 1 ? $list[$value] : $list;
    }
}
